<template>
    <div>
        <div class="goods" v-for=" (item,index) in goods" :key="index" @click="getDetails(item)" >
        <div class="goods-image" ><img v-lazy="item.avatar"></div>
            <div class="goods-info">
                <p class="title">{{ item.title }}</p>
                <p class="money">¥ {{ item.price }}</p>
            </div>
        </div>
        <!-- <div class="data_null">
            数据为空
        </div> -->
    </div>
</template>
<script>
export default {
    name:"storeGoods",
    props: {
        goods: Array,
    },
    data(){
        return {
            is_dataNull: true
        }
    },
    created(){
        this.is_data();
    },
    methods: {
        is_data(){
            if(this.goods){
                this.is_dataNull = false
            }else {
                this.is_dataNull = true
            }
        },
        getDetails(item){
            // console.log(this.$emit)
            this.$emit('getDetails',item)
        }
    }
}
</script>
<style scoped>
.goods {
    display: inline-block;
    width: 50%;
    transition: 3s;
    margin: 5px 0;
    background: white;
}
.goods .goods-image {
    width: 175px;
    height: 175px;
    margin: 0 auto;
    border-radius: 4px;
}
.goods .goods-image img {
    width: 100%;
    height: 100%;
}
.goods-info .title {
    text-overflow:ellipsis;
    white-space: nowrap;
    overflow: hidden;
}
.goods-info .money {
    color: #e93b3d;
}

</style>